<template>
    <div>
        <div v-for="message in messageList" :key="message.message.message_id">
            <el-link href.top="" target="_self" :underline="false" >
                <h3>{{ message.message.message_title }}</h3>
            </el-link>
            <div class="describe flex-center">
                <div class="mar-right-10"><i class="el-icon-view"></i> {{ message.message.message_browse }} </div>
                <div class="mar-right-10"><i class="iconfont icon-dianzan"></i>  {{ message.message.message_like }} </div>
                <div class="mar-right-10"><i class="iconfont icon-cai"></i> {{ message.message.message_unlike }} </div>
                <div class="flex-center">
                    <img style="height: 30px; width:30px; margin-right:5px;" 
                    :src="message.user.user_avatar" alt="头像">
                    <el-link href.pervent="" :underline="false" class="el-link">
                        {{ message.user.username }}
                    </el-link>
                </div>
            </div>
            <el-divider></el-divider>
        </div>
    </div>
</template>

<style scoped>
    .flex-center{
        display: flex;
        align-items: center;
    }  
    .mar-right-10{
        margin-right: 10px;
    } 
</style>

<script>
import {baseurl} from '@/param'

export default {
    name:'MyMessage',
    data() {
        return {
            messageList: [],
        }
    },
    mounted(){
        // getMessage(){
        axios.get (`${baseurl}/forum/queryMessage`,{
                params:{
                    id:parseInt(JSON.parse(sessionStorage.getItem('userInfo')).userid)
                },
                headers:{
                    'Authorization':sessionStorage.getItem('Authorization')
                } 
        })
        .then(res=>{
            if(res.data.code){
                this.messageList = res.data.data
            }
        }).catch(err=>console.log(err))
    }
}
</script>